Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Auth] Redirect user to the home page instead of a 500 page if their auth tokens fail to be refreshed #1118

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tanner-ricks
Copy link
Contributor

@tanner-ricks tanner-ricks commented Jan 24, 2025

Under the specific situation where a user has logged into the site and puts their computer to sleep, an error page redirection can happen when they come back to begin working working again. This was due to the fact that the auto renew couldn't work properly due to the login session token and refresh token both being expired by this point. It would be ideal for the behavior to be that it redirects the user to the home page instead.

Changes

  • Refactored axios to throw its request and response rejection errors
  • Refactored the useSblAuth api to automatically log a user out (and redirect them) if their access and redirect tokens are expired
  • Split App.tsx into three component files to improve readability
  • Added some commented out placeholder logic to app that can be used for notifying the user of impending idle logout
  • Refactored the ProtectedRoute to longer needs the auth object passed to it since it can just pull it in as a hook

How to test this PR

  1. Pull the branch for this PR
  2. Make sure other projects are up to date if necessary
  3. Restart the stack if necessary
  4. Access the website and log in
  5. Click the 'Filing' option in the navbar
  6. Click the 'Continue Filing' or start a new filing if necessary
  7. Put your computer to sleep and walk away for at least 30 minutes (the default keycloak refresh token lifetime)
  8. Once enough time has passed, open the computer back up
  9. Verify that you have not been redirected to the 500 error page, but have been redirected to the unauthenticated home page

@tanner-ricks tanner-ricks marked this pull request as ready for review February 4, 2025 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Auth] Redirect user to the home page instead of a 500 page if their auth tokens fail to be refreshed
1 participant